/**
 * @author LKQ
 * @date 2021/12/4 22:43
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums1 = {1, 2, 3, 0, 0 , 0};
        int[] nums2 = {2, 5, 6};
        solution.merge(nums1, 3, nums2, 3);
    }
    public void merge(int[] nums1, int m, int[] nums2, int n) {
        int first = nums1.length;
        while (first > 0) {
            if (m <= 0) {
                nums1[first-1] = nums2[n-1];
                n--;
                first--;
                continue;
            }
            if (n <= 0) {
                nums1[first-1] = nums1[m-1];
                m--;
                first--;
                continue;
            }
            if (nums2[n-1] >= nums1[m-1]) {
                nums1[first-1] = nums2[n-1];
                n--;
            }else {
                nums1[first-1] = nums1[m-1];
                m--;
            }
            first--;
        }
    }
}
